package cn.bdqn.tools;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

//璇诲彇閰嶇疆鏂囦欢鐨勫伐鍏风被鈥斺�鍗曚緥妯″紡
public class ConfigManager {
	//绫诲姞杞芥椂锛岃嚜琛岃繘琛屽垵濮嬪寲鎿嶄綔
	private static ConfigManager config = new ConfigManager();
	private static Properties pro;
	//绉佹湁鏋勯�鍣ㄢ�鈥旇鍙栨暟鎹簱閰嶇疆鏂囦欢
	private ConfigManager(){
		String configFile = "database.properties";
		pro=new Properties();
		InputStream is = ConfigManager.class.getClassLoader().getResourceAsStream(configFile);
		
		try {
			pro.load(is);
			is.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	//楗挎眽妯″紡
	public static ConfigManager getInstance(){
		return config;
	}
	
	public String getValue(String key){
		return pro.getProperty(key);
	}
}
